Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasm2c: Implement EHv4 #2513

Merged
merged 4 commits into from
Jan 18, 2025
Merged

wasm2c: Implement EHv4 #2513

merged 4 commits into from
Jan 18, 2025

Conversation

SoniEx2
Copy link
Collaborator

@SoniEx2 SoniEx2 commented Nov 20, 2024

Continuation of #2470 / #2512

@SoniEx2
Copy link
Collaborator Author

SoniEx2 commented Nov 20, 2024

@sbc100 (this might still have some nits? can't remember. something about updating comments?)

@SoniEx2
Copy link
Collaborator Author

SoniEx2 commented Nov 30, 2024

@sbc100 should be good now

@SoniEx2
Copy link
Collaborator Author

SoniEx2 commented Jan 12, 2025

hello @shravanrn @keithw @sbc100 can anyone take a look at this?

Copy link
Member

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

lgtm % comments

#if defined(WASM_RT_TABLE_OPS_FUNCREF) + \
defined(WASM_RT_TABLE_OPS_EXTERNREF) + \
defined(WASM_RT_TABLE_OPS_EXNREF) > \
1
#error \
"Expected only one of { WASM_RT_TABLE_OPS_FUNCREF, WASM_RT_TABLE_OPS_EXTERNREF } to be defined"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error should now include WASM_RT_TABLE_OPS_EXNREF?

/**
* The maximum size of an exception.
*/
#define WASM_EXN_MAX_SIZE 256
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In practice I think this will normally just be a 4-byte pointer. So maybe 32 is enough for now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

256 is what we use today, so we just used that. we would prefer not to break compatibility with existing wasm2c exception handling users (assuming we have some).

src/c-writer.cc Outdated
@@ -635,6 +638,19 @@ void CWriter::PopLabel() {
label_stack_.pop_back();
}

// static
constexpr bool CWriter::HasNonNullInitializers(Type type) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is always using in the negative how about inverting it? i.e. "NullOnlyInitializers"?

@sbc100 sbc100 merged commit 46648b0 into WebAssembly:main Jan 18, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants